﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace SqlPermissionsAuditor
{
    public class DataAccess
    {
        private string _connectString;

        public DataAccess(string connectString)
        {
            _connectString = connectString;
        }

        public DataSet ExecuteQuery(string query)
        {
            DataSet ds = new DataSet();
            using (SqlConnection connection = new SqlConnection(_connectString))
            {
                using (SqlDataAdapter da = new SqlDataAdapter(query, connection))
                {
                    da.Fill(ds);
                    return ds;
                }
            }
        }
    }
}
